package com.wbz.behavioral.strategy.context;

import com.wbz.behavioral.strategy.strategy.DiscountStrategy;

/**
 * 上下文对象
 */
public class StrategyOrderContext {
    private DiscountStrategy strategy;

    public StrategyOrderContext(DiscountStrategy strategy) {
        this.strategy = strategy;
    }

    public void setStrategy(DiscountStrategy strategy) {
        this.strategy = strategy;
    }

    public double calculateFinalPrice(double originalPrice) {
        return strategy.applyDiscount(originalPrice);
    }
}
